name: autofix.ci # Must be named this for autofix.ci to work

on:
  workflow_dispatch:
  pull_request:
  push:
    branches:
      - main

env:
  ZIG_VERSION: 0.12.0-dev.1828+225fe6ddb

permissions:
  contents: read

jobs:
  format:
    name: format
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          sparse-checkout: |
            src
            packages
            test
            bench
      - name: Setup Bun
        uses: oven-sh/setup-bun@v1
        with:
          bun-version: "1.0.21"
      - name: Setup Zig
        uses: goto-bus-stop/setup-zig@c7b6cdd3adba8f8b96984640ff172c37c93f73ee
        with:
          version: ${{ env.ZIG_VERSION }}
      - name: Install Dependencies
        run: |
          bun install
      - name: Format
        run: |
          bun fmt
          bun fmt:zig
      - name: Commit # https://autofix.ci/
        uses: autofix-ci/action@d3e591514b99d0fca6779455ff8338516663f7cc
